/* Main.Java
 * 
 * main program for the Tour Application
 * based on how the application is run
 * it will either pass standard input or
 * a file to the TourApp class for command
 * processing
 * 
 * Greg Warner
 * Derek Dupuis
 * Michael Dixey
 * Alex Schwartz
 */

import java.util.*;
import java.io.*;

/**
 * This class establishes a command source
 * and initiates processing of them
 * 
 */

public class Main
{
   public static void main( String[ ] args )
   {
      //default command source is system input
      Scanner sc = new Scanner( System.in );
      
      //command line argument.if present. identifies file name
      // as the command source -- overrides default System.in
      //
      if ( args.length > 0 )
      {
         try { sc = new Scanner( new File( args[ 0 ] ) ); }
         
         catch ( FileNotFoundException e )
         {
            System.out.println( e.getMessage() );
         }
         catch ( IOException e )
         {
            System.out.printf( "%s\n", e.getMessage() );
         }
         
      }
      
      //pass input source to the TourApp.java class and let it run
      //
      TourApp app = new TourApp( sc );
      app.processCMDs( );
      
      System.out.printf( "\nApp Done\n\n" );
   }
}